home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 …ember: Reference Library / Dev.CD Dec 96 RL / Dev.CD Dec 96 RL.toast / What's New? / Development Kits / Installer SDK Cornucopia 1.0 / Tidbits / Find Special Folder Code Rsrc / FindSpecialFolder.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-20  |  3.9 KB  |  84 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        FindSpecialFolder.h
  3.  
  4.     Contains:    FindSpecialFolder call to replace FindFolder for usage in action atoms, and allow them to be int'l friendly.
  5.  
  6.     Written by:    Chris Hansten, but most of the code is extracted from Installer 4.5. Thanks Kevin!
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     3/8/96    CEH        Created
  13.  
  14. */
  15.  
  16. #ifndef __FINDSPECIALFOLDER__
  17. #define __FINDSPECIALFOLDER__
  18.  
  19. // ****************
  20. // *** Includes ***
  21. // ****************
  22.  
  23. #include    "ActionAtomIntf.h"
  24. #include    "Types.h"
  25.  
  26. // ***************
  27. // *** DEFINES ***
  28. // ***************
  29.  
  30. // Note: The items below should not change.  For example, if a new Installer application goes to a new signature rsrc type
  31. //         and creator we will need to recompile. I will rewrite that portion of the code later 
  32.  
  33. #define kBlessedFolderNameStrRsrcID     3500    /* The ID of the STR rsrc that has the name of blessed folder ("System Folder") we create */
  34. #define kSpecialExtensionStrRsrcID         3501    /* The ID of the STR rsrc used internally to identify the script. */
  35. #define kInstallerSigRsrcType            'kajr'    /* Type of signature string of Installer app */
  36. #define kInstallerSigRsrcID                0        /* ID of signature string of Installer app */
  37.  
  38.  
  39. // *******************
  40. // *** Fn Declares ***
  41. // *******************
  42.  
  43. // ----- FindSpecialFolder -----
  44. //   Purpose:         This is a replacement for the FindFolder function. Instead of using the fld# resource in the running
  45. //                     System, which FindFolder does by default, it uses the same logic as the Installer application to decide 
  46. //                     which fld# is appropriate. This logic is described below.
  47. //   Assumptions:    None
  48. //
  49. //   Ins:            theVRefNum - The volume reference number of the volume on which we want to locate the directory
  50. //                     folderType - type of folder we're looking for, might be kAnyFolderType.
  51. //                     createFolder - pass in constant kCreateFolder to create dir if it doesn't already exist; otherwise pass in kDontCreateFolder
  52. //                     useSpecialFolders - Not important, but retained for consistency with original installer call. You MUST pass true in this param
  53. //
  54. //   Outs:           foundVRefNum - The volume reference number returned for the volume containing the directory specified in the folderType param
  55. //                     foundDirID - The dirID number returned for the directory specified in the folderType param
  56. //                     folderName - The folder name found is returned in this parameter.
  57. //
  58. //   Which fld# (folder list resource) should we use? Well, if you do a clean install of French SSW with US SSW running
  59. //   on the system, the fld# in the running System is English. However, the system we are installing is a French system,
  60. //   so we cannot simply do a FindFolder call and expect it to work. We must look for the "best" fld# to use.
  61. //
  62. //   We should use, in decreasing order of preference:
  63. //
  64. //       1.  The script's fld# resource should be first because it is under
  65. //           script writer's control. If the number of special folders has
  66. //           increased, the script writer should include an fld# resource
  67. //           in his script to reflects this change. The fld# resource in
  68. //           the script should probably be the same as the fld# in the new
  69. //           system file.
  70. //
  71. //       2.  The target system's should examined second because we might be
  72. //           installing a language module into the an existing System Folder.
  73. //           Since it could be any region, the only way is to get the fld#
  74. //           from the system we will be updating.
  75. //
  76. //       3.  The installer's fld# should be used as a last resort. It is most
  77. //           likely to be out of date. The only reason it would be used is when
  78. //           we are running on a system that does not have a folder manager.
  79.  
  80. OSErr             FindSpecialFolder(short theVRefNum, OSType folderType, Boolean createFolder, short *foundVRefNum, long *foundDirID, Boolean useSpecialFolders, StringPtr folderName);
  81.  
  82.  
  83. #endif
  84.